import request from '@/utils/request'

export const fetchBookList = (data) => {
  return request({
    url: '/book/list',
    method: 'get',
    params: data,
  })
}

export const createBook = (form) => {
  return request({
    url: '/book/add',
    method: 'post',
    data: form,
  })
}

export const deleteBook = (id) => {
  return request({
    url: `/book/${id}`,
    method: 'delete',
  })
}

export const updateBook = (form) => {
  return request({
    url: '/book/update',
    method: 'post',
    data: form,
  })
}

export const fetchBookDetail = (id) => {
  return request({
    url: `/book/${id}`,
    method: 'get',
  })
}
